package qsoft.com.tp51_test_java;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import org.jetbrains.annotations.NotNull;

import qsoft.com.tp51_scanner_module.IonReceived;
import qsoft.com.tp51_scanner_module.TP51_Scanner;
import qsoft.com.tp51_sn_module.TP51_SN;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView txtBar = findViewById(R.id.txtBar);
        TextView txtSn = findViewById(R.id.txtSn);

//        String action = "com.scanner.broadcast"; //这里可以改变扫描广播的action
//        String data = "data"; //这里可以改变扫描广播的extra
        String action = null;
        String data = null;

        new TP51_Scanner(this.getLifecycle(), action, data).setOnReceived(this, new IonReceived() {
            @Override
            public void onReceived(@NotNull String s) {
                txtBar.setText(s);
            }
        });

        String sn = new TP51_SN().getSerialNumber();
        txtSn.setText("本机SN：" + sn);
    }
}
